import { AddOrUpdateSpuParams } from "./spuModel";
/*
添加sku组件，需要的skuFormData数据类型（组件用的）
{
 "skuName": "string",
  "price": 0,
  "weight": "string",
  "skuDesc": "string",
  "skuDefaultImg": "string",
  // 组件收集到数据是string
  "skuAttrValueList": (string | undefined)[],
  "skuSaleAttrValueList": string[],
  "skuImageList": [
    {
      "imgName": "string",
      "imgUrl": "string",
      "isDefault": "string",
    }
  ],
}
添加sku的请求参数(不要id，不要category3Id)
{
  "skuName": "string",
  "price": 0,
  "weight": "string",
  "skuDesc": "string",
  "skuDefaultImg": "string",
  "skuAttrValueList": [
    {
      "attrId": 0,
      "attrName": "string",
      "valueId": 0,
      "valueName": "string"
    }
  ],
  "skuImageList": [
    {
      "imgName": "string",
      "imgUrl": "string",
      "isDefault": "string",
    }
  ],
  "skuSaleAttrValueList": [
    {
      "saleAttrId": 0,
      "saleAttrName": "string",
      "saleAttrValueId": 0,
      "saleAttrValueName": "string",
    }
  ],
}
修改sku的请求参数
{
  "category3Id": 0,
  "id": 0,
  "price": 0,
  "skuAttrValueList": [
    {
      "attrId": 0,
      "attrName": "string",
      "id": 0,
      "skuId": 0,
      "valueId": 0,
      "valueName": "string"
    }
  ],
  "skuDefaultImg": "string",
  "skuDesc": "string",
  "skuImageList": [
    {
      "id": 0,
      "imgName": "string",
      "imgUrl": "string",
      "isDefault": "string",
      "skuId": 0,
      "spuImgId": 0
    }
  ],
  "skuName": "string",
  "skuSaleAttrValueList": [
    {
      "id": 0,
      "saleAttrId": 0,
      "saleAttrName": "string",
      "saleAttrValueId": 0,
      "saleAttrValueName": "string",
      "skuId": 0,
      "spuId": 0
    }
  ],
  "spuId": 0,
  "tmId": 0,
  "weight": "string"
}
sku列表展示的数据
*/
export interface SkuImageItem {
  imgName: string;
  imgUrl: string;
  isDefault: "1" | "0";
  id?: number;
  skuId?: number;
  spuImgId?: number;
}
export type SkuImageList = SkuImageItem[];
export interface SkuItem {
  skuName: string;
  price: number | undefined;
  weight: number | undefined;
  skuDesc: string;
  skuDefaultImg: string;
  skuImageList: SkuImageList;
}
// 添加sku组件使用skuFormData数据
export interface SkuFormData extends SkuItem {
  skuAttrValueList: (string | undefined)[];
  skuSaleAttrValueList: Array<string | undefined>;
}
export interface SkuAttrValueItem {
  attrId: number;
  attrName: string;
  valueId: number;
  valueName: string;
  id?: number;
  skuId?: number;
}
export interface SkuSaleAttrValueItem {
  saleAttrId: number;
  saleAttrName: string;
  saleAttrValueId: number;
  saleAttrValueName: string;
  id?: number;
  skuId?: number;
  spuId?: number;
}
export type SkuAttrValueList = SkuAttrValueItem[];
export type SkuSaleAttrValueList = SkuSaleAttrValueItem[];
// 添加&修改sku的请求参数
export interface AddOrUpdateSkuParams extends SkuItem {
  category3Id?: number;
  id?: number;
  skuAttrValueList: SkuAttrValueList;
  skuSaleAttrValueList: SkuSaleAttrValueList;
  spuId?: number;
  tmId?: number;
}
// 通过spuId获取skuList的响应结果
export type SkuList = AddOrUpdateSkuParams[];
// 分页获取skuList响应结果
export interface GetSkuListApiResponse {
  records: SkuList;
  total: number;
}
